import Vue from 'vue';
import 'normalize.css/normalize.css'; // A modern alternative to CSS resets

import ElementUI from 'element-ui';
import VueVideoPlayer from 'vue-video-player';
import elTableInfiniteScroll from 'el-table-infinite-scroll';
import SelectionNum from '@/components/Common/elTable/selection';
import PageContainer from '@/components/Common/baseComponent/pageContainer';
import FixedPagination from '@/components/Common/baseComponent/fixedPagination';
import PriceColumn from '@/components/Common/baseComponent/priceTableColumn';
import ToolTip from '@/components/Common/baseComponent/toolTip';
import StatusText from '@/components/Common/baseComponent/statusText';
import SecretText from '@/components/Common/SecretText';
import UserInfo from '@/components/Common/baseComponent/UserInfo';
import PlainCreateBtn from '@/components/Common/baseComponent/plain-create-btn';
import FbCascader from '@/components/Common/baseComponent/fb-cascader';
import NodeWrap from '@/views/legal/process/components/nodeWrap';
import processSn from '@/components/AuditProcess/processSn';
import tipIcon from '@/components/Common/tipIcon';
import infoIcon from '@/components/Common/baseComponent/infoIcon';
import CheckUserInfo from '@/components/Common/baseComponent/CheckUserInfo/index.js';
import DeniedPlaceholder from '@/components/Common/deniedPlaceholder';
import Ellipsis from '@/components/Common/baseComponent/Ellipsis/index.vue';

import 'element-ui/lib/theme-chalk/index.css';
import '@wangeditor/editor/dist/css/style.css'; // 富文本样式
// import locale from 'element-ui/lib/locale/lang/zh-CN'; // lang i18n

import '@/styles/index.scss'; // global css
import '../src/styles/element-variables.scss';
import '@/styles/common.css'; // 通用 css
import 'video.js/dist/video-js.css';

import App from './App';
import router from './router';
import store from './store';

import '@/icons'; // icon
import '@/router/guards'; // permission control

import FilterInput from '@/components/Tool/filter';
import onlyNumber from '@/directive/el-input'; // 添加此行=>自定义全局指令
import loadmore from '@/directive/loadmore';
import tableFixedScrollbar from '@/directive/tableFixedScrollbar';
import selectScroll from '@/directive/selectScroll';

import { UTableColumn, UTable, UxGrid, UxTableColumn } from 'umy-ui';
Vue.use(UTableColumn);
Vue.use(UTable);
Vue.use(UxGrid);
Vue.use(UxTableColumn);
Vue.use(VueVideoPlayer);

import VueClipboard from 'vue-clipboard2';

import '@/utils/ddLogin';
if (process.env.SENTRY_LINK && process.env.NODE_ENV !== 'development') {
  const Raven = (() => require('raven-js'))();
  const RavenVue = (() => require('raven-js/plugins/vue'))();
  Raven.config(process.env.SENTRY_URL) // 这里可传参数不止一个，包括传入环境、版本号等，有兴趣的可以查阅官方文档，但是这些参数可以通过下文的插件配置
    .addPlugin(RavenVue, Vue)
    .install();
}
Vue.component('FilterInput', FilterInput);
Vue.component('SelectionNum', SelectionNum);
Vue.component('PageContainer', PageContainer);
Vue.component('FixedPagination', FixedPagination);
Vue.component('PriceColumn', PriceColumn);
Vue.component('ToolTip', ToolTip);
Vue.component('StatusText', StatusText);
Vue.component('PlainCreateBtn', PlainCreateBtn);
Vue.component('NodeWrap', NodeWrap);
Vue.component('FbCascader', FbCascader);
Vue.component('processSn', processSn);
Vue.component('tipIcon', tipIcon);
Vue.component('InfoIcon', infoIcon);
Vue.component('DeniedPlaceholder', DeniedPlaceholder);
Vue.component('UserInfo', UserInfo);
Vue.component('CheckUserInfo', CheckUserInfo);
Vue.component('SecretText', SecretText);
Vue.component('Ellipsis', Ellipsis);

Vue.use(VueClipboard);
Vue.use(ElementUI);
Vue.use(elTableInfiniteScroll);
Vue.use(onlyNumber); // 添加此行=>使用该全局指令
Vue.use(loadmore); // 添加此行=>使用该全局指令
Vue.use(tableFixedScrollbar); // 添加此行=>使用该全局指令
Vue.use(selectScroll);
Vue.config.productionTip = false;
Vue.directive('focus', {
  // 当被绑定的元素插入到 DOM 中时……
  inserted: function(el) {
    el.querySelector('.el-input__inner').focus();
  }
});

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
});
